package main

import (
	"fmt"
	"math/rand"
	"time"

	"github.com/go-redis/redis"
)

func main1() {
	redisConnect()
}
func redisConnect() {
	server := redis.NewClient(&redis.Options{
		Addr: "127.0.0.1:6379",
		DB:   0,
	})
	for i := 0; i < 20; i++ {
		time.Sleep(time.Second)
		rand.Seed(time.Now().Unix())
		num := rand.Intn(1000)
		n, _ := server.Publish("channel", num).Result()
		fmt.Println(n)
	}
}
